-
-
Notifications
You must be signed in to change notification settings - Fork 61
perf: py_venv.bzl optimizations #725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| site_packages_pth_file, | ||
| env_file, | ||
| venv_tool, | ||
| ] + py_toolchain.files.to_list()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
py_toolchain should already be in rfs
|
9f5d7d1 to
1c9b48c
Compare
| @@ -1,5 +1,5 @@ | |||
| # tools_telemetry | |||
| bazel_dep(name = "aspect_tools_telemetry", version = "0.2.8") | |||
| bazel_dep(name = "aspect_tools_telemetry", version = "0.3.2") | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop. Already updated.
| workspace_name = ctx.workspace_name | ||
|
|
||
| args = ctx.actions.args() | ||
| args.add_all([venv_dir], expand_directories = False, format_each = "--location=%s") | ||
| args.add(py_shim.bin.bin, format = "--venv-shim=%s") | ||
|
|
||
| # Post-bzlmod we need to record the current repository in case the | ||
| # user tries to consume a `py_venv_binary` across repo boundaries | ||
| # which could cause repo mapping to become relevant. | ||
| args.add( | ||
| ctx.label.repo_name or workspace_name, | ||
| format = "--repo=%s", | ||
| ) | ||
| args.add_all( | ||
| [py_toolchain], | ||
| map_each = lambda py_toolchain: _interpreter_path(workspace_name, py_toolchain), | ||
| format_each = "--python=%s", | ||
| allow_closure = True, | ||
| ) | ||
| args.add(site_packages_pth_file, format = "--pth-file=%s") | ||
| args.add(env_file, format = "--env-file=%s") | ||
| args.add_all([ctx.bin_dir], expand_directories = False, format_each = "--bin-dir=%s") | ||
| args.add(ctx.attr.package_collisions, format = "--collision-strategy=%s") | ||
| args.add(venv_name, format = "--venv-name=%s") | ||
| args.add(ctx.attr.mode, format = "--mode=%s") | ||
| args.add( | ||
| "{}.{}".format( | ||
| py_toolchain.interpreter_version_info.major, | ||
| py_toolchain.interpreter_version_info.minor, | ||
| ), | ||
| format = "--version=%s", | ||
| ) | ||
| args.add( | ||
| "true" if ctx.attr.include_system_site_packages else "false", | ||
| format = "--include-system-site-packages=%s", | ||
| ) | ||
| args.add( | ||
| "true" if ctx.attr.include_system_site_packages else "false", | ||
| format = "--include-user-site-packages=%s", | ||
| ) | ||
|
|
||
| if ctx.attr.debug: | ||
| args.add("--debug") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems worthwhile if we can peel it out.


.pathusage so we can enable path-mapping and dedupe the action across configsChanges are visible to end-users: no
Test plan